package com.globalwave.common.web;

import com.globalwave.base.BaseAction;
import com.globalwave.common.ArrayPageList;
import com.globalwave.common.entity.SyncColumns;
import com.globalwave.common.entity.SyncColumnsCriterion;
import com.globalwave.common.service.SyncColumnsService;
import com.opensymphony.xwork2.Preparable;

public class SyncColumnsAction extends BaseAction implements Preparable {

    private static final long serialVersionUID = 8582051849254108462L;
    
    private SyncColumnsService syncColumnsService ;
    private SyncColumns syncColumns ;
    private SyncColumnsCriterion criterion ; 

    
    public String execute() throws Exception {    
        return this.list();    
    }
    
    public String list() throws Exception {      
        
        ArrayPageList<SyncColumns> pageList = 
            syncColumnsService.query(criterion,pageIndex,pageSize,null) ;

        renderXML(pageList.asXML()) ;
        
        return null ;    
        
    }
    
    public String create()  throws Exception {              
        
        Object newSyncColumns = syncColumnsService.create(syncColumns) ;

        renderXML(this.getSuccessCreateMessage(newSyncColumns).asXML()) ;
        
        return null;    
        
    }
    
    public String update()  throws Exception {     
        
        syncColumnsService.update(syncColumns) ;

        renderXML(this.getSuccessUpdateMessage(syncColumns).asXML()) ;
        
        return null;    
        
    }
    
    public String delete()  throws Exception {
        if (ids == null) { 
            syncColumnsService.delete(syncColumns) ;
        } else {
            syncColumnsService.deleteAll(ids) ;
        }

        renderXML(this.getSuccessDeleteMessage().asXML()) ;
        
        return null;    
        
    }
    
    public void prepare() throws Exception {
        // Auto-generated method stub , donothing
        
    }
    
    public void setSyncColumnsService(SyncColumnsService syncColumnsService) {
        this.syncColumnsService = syncColumnsService;
    }

    public SyncColumns getSyncColumns() {
        return syncColumns;
    }

    public void setSyncColumns(SyncColumns syncColumns) {
        this.syncColumns = syncColumns;
    }

    public SyncColumnsCriterion getCriterion() {
        return criterion;
    }

    public void setCriterion(SyncColumnsCriterion criterion) {
        this.criterion = criterion;
    }

}
